﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using famails.iface;
using famails.dao;
namespace famails.bus
{
    /// <summary>
    /// Summary description for ArticleBUS
    /// </summary>
    public class ArticleBUS : IArticle
    {
        ArticleDAO cateDao;
        public ArticleBUS()
        {
            cateDao = new ArticleDAO();
        }

        #region IArticle Members

        public DataTable GetByID(int ID)
        {
            return cateDao.GetByID(ID);
        }
        public DataTable Get2EditByID(int ID)
        {
            return cateDao.Get2EditByID(ID);
        }

        #endregion


        public DataTable Search(string keyword, int show, int categoryid, int groupid)
        {
            return cateDao.Search(keyword, show, categoryid, groupid);
        }

        public bool Insert(dto.ArticleDTO dto)
        {
            return cateDao.Insert(dto);
        }

        public bool Edit(dto.ArticleDTO dto)
        {
            return cateDao.Edit(dto);
        }

        public bool Delete(int id)
        {
            return cateDao.Delete(id);
        }

        public bool CheckExistsName(string name, int id)
        {
            return cateDao.CheckExistsName(name, id);
        }



        public DataTable GetTop1Read()
        {
            return cateDao.GetTop1Read();
        }

        public DataTable GetNewest()
        {
            return cateDao.GetNewest();
        }

        public DataTable GetTopByGroupID(int top, int GroupID)
        {
            return cateDao.GetTopByGroupID(top, GroupID);
        }


        public bool ViewCount(int ArticleID)
        {
            return cateDao.VIewCount(ArticleID);
        }
    }
}